<template>
  <view :style="{ height: screenHeight + 'px', width: screenWidth + 'px' }" class="all-container">
    <text class="job-wanted-fortune-box">求职运势卡</text>

    <view class="person-head-box">
      <u-avatar width="102" height="102" mode="circle" :src="fortuneCard.personPic" />

      <text class="name-box">{{ fortuneCard.personIname }}</text>
    </view>

    <text class="big-text-box">{{ fortuneCard.title }}</text>

    <text class="content-box">{{ fortuneCard.desc }}</text>

    <view class="bottomBox" v-if="!fromZhituCard">
      <text class="confirm-box" @click="judgeOtherBiographical">
        评定其他简历
      </text>

      <text class="checkHistoryReport" @click="checkHistoryReport">查看历史报告</text>
    </view>
  </view>
</template>

<script>
import { updateResumeDiagnoseReadStat } from "@/api/index";
import { showDelayToastTip } from "@/utils/handle";
export default {
  props: {
    fortuneCard: {
      type: Object,
      default: function () {
        return {};
      },
    },

    recordId: {
      type: String,
      default: "",
    },
    fromZhituCard: {
      type: Boolean,
      default: false,
    },
  },

  data() {
    return {
      screenHeight: 0,
      screenWidth: 0,
      personId: uni.getStorageSync("person-id").slice(2) || undefined,
    };
  },

  onReady() {
    let systemInfo = uni.getSystemInfoSync();
    this.screenHeight = systemInfo.windowHeight;
    this.screenWidth = systemInfo.windowWidth;
  },

  watch: {
    // fortuneCard: {
    //   handler(val) {
    //     this.drawPersonHead();
    //   },
    //   deep: true, // 深度监听
    //   immediate: false, // 初始化的时候立刻执行一次
    // },
  },

  methods: {
    judgeOtherBiographical() {
      // 评定其他简历
      let param = {
        personId: this.personId,
        diagnoseRecordId: this.recordId,
      };
      uni.showLoading();
      updateResumeDiagnoseReadStat(param).then((res) => {
        uni.hideLoading();
        if (res.code == 200) {
          if (res.data) {
            uni.redirectTo({
              url: "/pagesSub/career/activity/AttachmentUpload",
            });
          } else {
            showDelayToastTip("未知错误", 50);
          }
        } else {
          showDelayToastTip(res.status_desc, 50);
        }
      });
    },

    //查看简历评定的历史报告
    checkHistoryReport() {
      uni.navigateTo({ url: "/pagesSub/resume/diagnosisHistory/index" });
    },
  },
};
</script>
<style  lang="scss" scoped>
.all-container {
  width: 100%;
  height: 100%;
  background-image: url($img-base + "career/diagnosis/judge_result_end_page_bg.png");
  background-size: 100% 100%;

  display: flex;
  flex-direction: column;
  align-items: center;

  .job-wanted-fortune-box {
    width: auto;
    position: fixed;
    top: 25%;
    color: #040403;
    font-size: 70rpx;
    font-weight: bolder;
  }

  .person-head-box {
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;
    width: auto;
    position: fixed;
    top: 35%;

    .name-box {
      color: #040403;
      font-size: 28rpx;
      margin-top: 20rpx;
      font-weight: bold;
    }
  }

  .big-text-box {
    width: auto;
    position: fixed;
    color: #468b39;
    font-size: 56rpx;
    top: 51%;
    font-weight: bolder;
  }

  .content-box {
    width: 52%;
    position: fixed;
    text-align: left;
    color: #666666;
    font-size: 28rpx;
    top: 59%;
  }

  .bottomBox {
    display: flex;
    justify-content: center;
    flex-direction: column;
    position: fixed;
    bottom: 60rpx;
    width: 84%;
    .confirm-box {
      display: flex;
      justify-content: center;
      flex-direction: column;
      width: 100%;
      height: 88rpx;
      margin-bottom: 20rpx;
      font-size: 32rpx;
      color: #ffffff;
      text-align: center;
      background-size: 100% 100%;
      background-image: url($img-base + "career/diagnosis/judge_result_end_page_btn_bg.png");
    }
    .checkHistoryReport {
      display: flex;
      justify-content: center;
      flex-direction: column;
      width: 100%;
      height: 88rpx;
      font-size: 32rpx;
      color: #ffffff;
      text-align: center;
      background-size: 100% 100%;
      background-image: url($img-base + "career/diagnosis/judge_result_end_page_btn_bg.png");
    }
  }
}
</style>